var constant = require('../common/constant');
registService.$inject=['$http'];

function registService($http){
    return {
        regist:regist
    }

    function regist(data,callback){
        var baseUrl = constant.BaseUrl;
        var fd = new FormData();
        console.log("data:"+data);
        for(var key in data)
            fd.append(key, data[key]);
        $http.post(baseUrl+'/merchant', fd, {
            transformRequest: angular.indentity,
            headers: { 'Content-Type': undefined }
        }).then(function successCallback(response) {
            callback(response);
        }, function errorCallback(response) {
            // 请求失败执行代码
            callback(response);
        });
    }
}

module.exports = registService;